# -*- coding: utf-8 -*-
from django.db import models
from datetime import datetime
from apps.later_stage.conf import FAULT_TYPE


class FaultHistory(models.Model):
    name = models.CharField('故障名称', max_length=40)
    type = models.CharField('故障分类', max_length=20, choices=FAULT_TYPE)
    address = models.CharField('故障地点', max_length=200,
            null=True, blank=True)
    fault_time = models.DateField('故障时间', default=datetime.now())
    recover_time = models.DateField('恢复时间', default=datetime.now())
    summary = models.TextField('故障描述', null=True, blank=True)
    reason = models.TextField('故障原因', null=True, blank=True)

    def __unicode__(self):
        return self.name

    class Meta:
        verbose_name = '故障历史'
        verbose_name_plural = '善后阶段|故障历史(FaultHistory)'


class Experience(models.Model):
    name = models.CharField('经验名称', max_length=40)
    experience = models.TextField('经验教训', null=True, blank=True)
    method = models.TextField('处理方法', null=True, blank=True)
    summary = models.TextField('经验总结', null=True, blank=True)
    remarks = models.TextField('备注', null=True, blank=True)

    def __unicode__(self):
        return self.name

    class Meta:
        verbose_name = '经验教训'
        verbose_name_plural = '善后阶段|经验教训(Experience)'
